import mongoose from 'mongoose'
import config from '../../config'
import autoIncrement from 'mongoose-auto-increment'
let Schema = mongoose.Schema

const formsSchema = new mongoose.Schema({
	 _id: Number,
  form_type: { type: String, default: 'normal' },
  form_name: { type: String , required: true},
  form_subtitle: {type: String},
  form_datajson: {type: Schema.Types.Mixed,default:{}},
  form_tablename:{type: String,index: true, unique: true },
  form_create_time: {type: Date,default: Date.now},
  form_enable_time: {type: Date,default: Date.now},
  form_disable_time: {type: Date,default: Date.now}

})

formsSchema.plugin(autoIncrement.plugin, 'forms');

formsSchema.methods.method1 = function method1 (password) {
  // console.log('~/src/models/form.js----这里是处理一些业务逻辑层的数据')

  return 'console 方法已经执行'
}


export default mongoose.model('Forms', formsSchema)
